/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rie06.openvoip.client.IHM.communication;

import java.awt.Color;
import java.awt.Dimension;
import javax.swing.*;
import org.apache.log4j.Logger;

/**
 *
 * @author Sylvain
 */
public class PanelOption extends JPanel {

    private WindowDialog dialogWindow;
    private JButton buttonAddContactDialog;
    private JButton buttonCloseConversation;
    private JButton buttonPauseAllConversation;
    private JButton buttonCallConversation;
    private CommunicationController communicationController;
    private static final Logger logger = Logger.getLogger(PanelOption.class);

    public PanelOption(WindowDialog dialogWindow, CommunicationController communicationController) {

        this.communicationController = communicationController;
        this.dialogWindow = dialogWindow;
        this.setBackground(Color.darkGray);
        this.setSize(200, 700);
        this.setVisible(true);


        if (dialogWindow.getConversation().isMaster()) {
            ImageIcon icon = new ImageIcon("images/addContact.png");
            buttonAddContactDialog = new JButton(icon);
            buttonAddContactDialog.addActionListener(this.communicationController);
            buttonAddContactDialog.setActionCommand("buttonAddContactDialog");
        }

        ImageIcon iconCall = new ImageIcon("images/call.png");
        buttonCallConversation = new JButton(iconCall);
        buttonCallConversation.addActionListener(this.communicationController);
        buttonCallConversation.setActionCommand("buttonCallConversation");

        ImageIcon iconPause = new ImageIcon("images/pauseAll48.png");
        buttonPauseAllConversation = new JButton(iconPause);
        buttonPauseAllConversation.setEnabled(false);
        buttonPauseAllConversation.addActionListener(this.communicationController);
        buttonPauseAllConversation.setActionCommand("buttonPauseAllDialog");

        ImageIcon iconClose = new ImageIcon("images/closeConversation48.png");
        buttonCloseConversation = new JButton(iconClose);
        buttonCloseConversation.addActionListener(this.communicationController);
        buttonCloseConversation.setActionCommand("buttonCloseDialog");

        if (dialogWindow.getConversation().isMaster()) {
            this.add(buttonAddContactDialog);
        }
        this.add(buttonCallConversation);
        this.add(buttonPauseAllConversation);
        this.add(buttonCloseConversation);


    }

    public WindowDialog getDialogWindow() {
        return dialogWindow;
    }

    public JButton getButtonAddContactDialog() {
        return buttonAddContactDialog;
    }

    public JButton getButtonCallConversation() {
        return buttonCallConversation;
    }

    public JButton getButtonCloseConversation() {
        return buttonCloseConversation;
    }

    public JButton getButtonPauseAllConversation() {
        return buttonPauseAllConversation;
    }

    public CommunicationController getCommunicationController() {
        return communicationController;
    }
}
